var status = 0;
var tree = 0;

function start() {
    status = -1;
    action(1, 0, 0);
}
 
function action(mode, type, selection) {
	if (mode == -1) {
        	cm.dispose();
	} else {
        	if (mode == 0 && status == 0) {
			cm.sendOk("See you later");
        		cm.dispose();
        		return;
        	}
        	if (mode == 1)
            		status++;
	        else
        		status--;
	        if (status == 0) {
			cm.sendSimple("Hey there #h #, Which tree do you want to decorate?\r\n#b#L1#I want to go to tree #e1#n#l\r\n#L2#I want to go to tree #e2#n#l\r\n#L3#I want to go to tree #e3#n#l\r\n#L4#I want to go to tree #e4#n#l\r\n#L5#I want to go to tree #e5#n#l#k\r\n#r#L6#I dont feel like decorating#l#k");
		} else if (status == 1) {
			if (selection >= 1 && selection <= 5) {
				tree = selection;
				cm.sendYesNo("Are you sure you want to go to tree " + tree + "?");
			} else {
				cm.sendOk("Oh ok, goodbye!");
				cm.dispose();
			}
		} else {
			cm.warp(209000000 + tree + 10);
			cm.dispose();
		}
	}
}